<?php
abstract class system_cache {
    
	public static $_storage = 'file';
	public static $_options = array(
			'expire' => 3600
	);
    
    /**
     * @return system_cache_interface
     */
	public static function factory($name, $options = array()) {
		self::$_options['expire'] = system_session::getOptions('cache_expire');
    	self::setOptions($options);    	
		$class = 'system_cache_' . self::$_storage;
		return new $class(self::$_options);
	}
	
	public static function setOptions($options) {
		if(!is_array($options)) {
			throw new system_cache_exception("Options should be an array formation.");
		}
		foreach($options AS $key => $value) {
			self::$_options[$key] = $options[$key];
		}
	}

}
